package cn.wolfcode.p2p.business.domain;
/**
 * 线下充值
 */

import cn.wolfcode.p2p.base.domain.BaseAuditDomain;
import cn.wolfcode.p2p.base.domain.BaseDomain;
import cn.wolfcode.p2p.util.Constants;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.text.DateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Setter@Getter
public class RechargeOffline extends BaseAuditDomain{

    private String tradeCode; //充值单号

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date tradeTime; //交易时间

    private BigDecimal amount = Constants.ZERO; //充值金额

    private String note; //充值说明

    private PlatformBankInfo bankInfo; //充值银行

    /**
     * 审核借款json
     *
     * @return
     */
    public String getJsonString() {
        Map<String, Object> map = new HashMap();
        map.put("id", this.id);
        map.put("username", applier.getUsername());
        map.put("tradeCode", this.tradeCode);
        map.put("amount", this.amount);
        map.put("tradeTime", DateFormat.getDateInstance().format(tradeTime));
        try {
            return (new ObjectMapper()).writeValueAsString(map);
        } catch (JsonProcessingException var3) {
            var3.printStackTrace();
            return null;
        }
    }

}